// 引入路由
import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import Kind from '../views/Kind.vue'
import Cart from '../views/Cart.vue'
import My from '../views/My.vue'
import Error from '../views/Error.vue'
import Detail from '../views/Detail.vue'
import Footer from '../components/Footer/Footer.vue'

Vue.use(VueRouter)
// 配置路由
const routes = [
  {
    path: '/',
    redirect: '/Home',  //重新定向到home上
  },
  {
    path: '*',   //不是路由规则的时候定义到error上
    name: 'Error',
    component: Error
  },

  {
    path: '/home',
    name: 'Home',
    components:{
      default:Home,Footer
    } 
  },
  {
    path: '/kind',
    name: 'Kind',
    components: {
      default:Kind,Footer
    }
  },
  {
    path: '/cart',
    name: 'Cart',
    components: {
      default:Cart,Footer
    }
  },
  {
    path: '/my',
    name: 'My',
    components: {
      default:My,Footer
    }
  },
  { 
    // /:proid接受动态的id  动态路由需要单独配置
    path: '/detail/:proid',
    name: 'Detail',
    component: Detail
  },
]

const router = new VueRouter({
  routes
})

export default router
